<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<link rel="stylesheet" href="./../css/sitenav.css">
<script src="./../js/flexible.js"></script>

<body>
    <!-- 头部 -->
    <div class="hand">
        <a href="./index.html">&lt;</a>
        <h4>商品导航</h4>
        <a href=""><img src="./../assets/images/header_app.png" alt=""></a>
    </div>


    <div class="wz">
        <ul class="u1">
            <li class="lis">
                <img src="" alt="">
                <a href=""></a>
            </li>
        </ul>
        <!-- <span class="u1">
            <a href=""></a>
        </span> -->
    </div>

    <!-- <div class="backkk">
        <a href="index.html">首页&gt;</a>
        <a href="">优惠卷</a>
    </div> -->
    <div id="footer">
        <!-- <div class="more">
            <a href>更多优惠信息&gt;&gt;</a>
        </div> -->
        <div class="chart">
            <span class="chart-1">品牌排行</span>
            <span class="chart-2">&gt;&gt;</span>
        </div>
        <div class="login">
            <div class="row-1">
                <a href="">
                    <div>登入</div>
                </a>
                <a href="">
                    <div>注册</div>
                </a>
                <a href="">
                    <div>返回顶部</div>
                </a>
            </div>
            <div class="row-2">
                <p>
                    <a href="">手机APP下载</a>
                    <a href="">慢慢买手机版</a>
                    "--掌上比价平台"
                </p>
                <p>m.manmanbuy.com </p>
            </div>
            <!-- <a href=""></a> -->
        </div>
    </div>
</body>

</html>
<script>
    fetch("http://chst.vip:1234/api/getsitenav")
        .then(body => body.json())
        .then(res => {
            console.log(res.result, 5555);
            let html = "";

            res.result.forEach(item => {
                html += `
                <a href="${item.navHref}">
                <li productid=${item.navId}>
                   <img src="${item.navImg}">
                    ${item.navTitle}
                    </li>
                </a>
               `
            })
            let u1 = document.querySelector(".u1")
            u1.innerHTML = html

            //点击事件
            let lis = document.querySelector(".lis");

            [...lis].forEach(li => {
                li.onclick = function () {
                    let navId = this.getAttrbute("navId")
                    location.href = `./sitenav.html?productid=${navId}`

                }
            })
        })



</script>
<script src="https: //cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>